package com.tyf.common.config;

import com.tyf.common.dao.support.SimpleBaseRepositoryFactoryBean;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.context.annotation.ImportResource;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import java.lang.annotation.*;

/**
 * @author liutao<br>
 * @ClassName: EydSpringBootApplication<br>
 * @Description: 应用程序boot配置<br>
 * 具有注解{@code @SpringBootApplication}特性，spring boot启动注解<br>
 * 在启动类上面只需要使用注解{@code @EydSpringBootApplication}即可<br>
 * @date 2016年9月18日上午10:55:56<br>
 */
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
@SpringBootApplication(scanBasePackages = {"com.tyf"})    //开启spring注解
@EnableJpaRepositories(basePackages = {
        "com.tyf.**.dao"}, repositoryFactoryBeanClass = SimpleBaseRepositoryFactoryBean.class) //jpa的dao层扫描
@EntityScan(basePackages = {"com.tyf.**.domain"}) //jpa类扫描
@EnableCaching  //开启对spring caching的支持
@EnableAsync    //开启对异步调用的支持
@EnableTransactionManagement    //开启@Transactional注解
@EnableAspectJAutoProxy(exposeProxy = true, proxyTargetClass = true)
//以下为引入事务aop，如果直接在类和方法上加入 @Transactional，为导致单元测试，属性注入为空，原因待查 xiangdong
@ImportResource({"classpath:spring-tx.xml"})    //引入spring配置文档
public @interface EudSpringBootApplication {

}
